<?php
if (!isset($update)) {
    ?>
    <div id="post-audio-form" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
    	<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    	<h3 id="myModalLabel">Post Audio</h3>
        </div>
	<?php
    }
    $form = $this->beginWidget('CActiveForm', array(
	'id' => 'post-form',
	'enableAjaxValidation' => FALSE,
	'enableClientValidation' => true,
	'clientOptions' => array(
	    'validateOnSubmit' => true
	),
	'htmlOptions' => array(
	    'class' => 'form-horizontal',
	    'enctype' => "multipart/form-data"
	)
    ));
    ?>
    <div class="<?php
    if (!isset($update))
	echo 'modal-body';
    else
	echo 'edit-post-body'
	?>">
	<p>
	    <?php
	    echo $form->label($model, 'title');
	    echo $form->textField($model, 'title', array('class' => 'input-post'));
	    echo $form->error($model, 'title');

	    echo $form->label($model, 'content');
	    echo $form->textArea($model, 'content', array('class' => 'input-post'));
	    echo $form->error($model, 'content');
	    ?>
	    <label>Audio</label>	    
	    <?php
	    $audio = $model->getAudio();
	    if ($audio) {
		echo '<br>' . $audio . '<br>';
	    }
	    ?>
	    <input type='file' accept='audio/*' name='audio'/>	
	    <br>
	    <br>
	    <select class="select-type-addition">
		<option value="">Add Content</option>
		<option value="photo">Photo</option>
		<option value="video">Video</option>
	    </select>
	    <a href="javascript:void(0)" class="btn btn-primary btn-add-addition">Add</a>
	    <span class='wrap-upload-addition'>
	    </span>
	    <?php
	    echo '<br>';
	    echo $form->label($model, 'tags');
	    echo $form->textField($model, 'tags', array('class' => 'input-post'));
	    echo $form->error($model, 'tags');

//	    echo '<br>';
//	    echo $form->label($model, 'is_private');
//	    echo $form->dropDownList($model, 'is_private', array('0' => 'Public', '1' => 'Private'), array('class' => 'input-post'));
//	    echo $form->error($model, 'is_private');
	    ?>	    	    	    

	</p>
    </div>
    <input type='hidden' value="<?php echo Posts::TYPE_AUDIO; ?>" name="Posts[post_type]"/>
    <div class="modal-footer">
	<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
	<input type="submit" class="btn btn-info" value="Create" name='posting'/>
    </div>

    <?php
    $this->endWidget();
    ?>
    <?php if (!isset($update)) { ?>
    </div>
    <?php
}?>